<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
    $data=$_POST['data'];
    $arr = json_decode($data);
    $id=$arr[0];
    $name=$arr[1];
    $year=$arr[2];
    session_start();
    if($_SESSION['login']!='y'){
        $url = 'login.html';
        Header("Location: $url");
    }
  /*  $time = time();
  $date = getdate($time);
  $year = $date["year"];
  $mon = $date["mon"];
  $day = $date["mday"];*/
    include('class.php');
    $db = new DB();
?>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">

		<script type="text/javascript" src="jQuery.js"></script>
		<script type="text/javascript" src="jqplot.js"></script>

		<link rel="stylesheet" href="bootstrap-theme.css">
		<link rel="stylesheet" href="bootstrap-theme.min.css">
		<link rel="stylesheet" href="bootstrap.min.css">
		<link rel="stylesheet" href="bootstrap.css">
		<link rel="stylesheet" href="DIY.css">

	</head>

	<body>
		<div class="container">
			<ul class="nav nav-tabs">
				<li role="presentation"><a href="Namelist.php">Staff Information</a></li>
				<li role="presentation"><a href="CheckAttendanceForManager.php">Check Attendance</a></li>
				<li role="presentation" class="active"><a href="AttendanceStatistics.php">Attendance Statistics</a></li>
				<li role="presentation"><a href="DailyAssignment.php">Daily Assignment</a></li>
				<li role="presentation"><a href="BulletinForManager.php">Bulletin</a></li>
				<a class="logout" href="Logout.php">Log out</a>
				<label class="logout">Company Name</label>

			</ul>
			<div class="panel panel-default">

			</div>
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">Attendance Statistics</h3>
					<?php echo $year ?>
				</div>
				<div class="panel-body chart">
					<div id="chart1"></div>

					<div style="text-align:center;clear:both;">
						<script src="/gg_bd_ad_720x90.js" type="text/javascript"></script>
						<script src="/follow.js" type="text/javascript"></script>
					</div>

					<div id="chart2"></div>
				</div>
			</div>
			<script type="text/javascript">
				/*var data=new Array();
				    var k=1;
				    for(var j=0;j<2;j++){
				        data[j]=new Array();
				        for(var i=0;i<12;i++){
				        data[j][i]=k;
				        k++;
				    }
				    }*/
                    
                    
                    
                
                
				var data = new Array();
				//data=[1,2,3,4,5,6,7,8,9];
				<?php
                
        $Jan=$db->getAttendancein($name,$id,$year,'1');
        $Feb=$db->getAttendancein($name,$id,$year,'2');
        $Mar=$db->getAttendancein($name,$id,$year,'3');
        $Apr=$db->getAttendancein($name,$id,$year,'4');
        $May=$db->getAttendancein($name,$id,$year,'5');
        $Jun=$db->getAttendancein($name,$id,$year,'6');
        $Jue=$db->getAttendancein($name,$id,$year,'7');
        $Aug=$db->getAttendancein($name,$id,$year,'8');
        $Sep=$db->getAttendancein($name,$id,$year,'9');
        $Oct=$db->getAttendancein($name,$id,$year,'10');
        $Nov=$db->getAttendancein($name,$id,$year,'11');
        $Dec=$db->getAttendancein($name,$id,$year,'12');
        
        $Jan1=$db->getAttendancefo($name,$id,$year,'1');
        $Feb1=$db->getAttendancefo($name,$id,$year,'2');
        $Mar1=$db->getAttendancefo($name,$id,$year,'3');
        $Apr1=$db->getAttendancefo($name,$id,$year,'4');
        $May1=$db->getAttendancefo($name,$id,$year,'5');
        $Jun1=$db->getAttendancefo($name,$id,$year,'6');
        $Jue1=$db->getAttendancefo($name,$id,$year,'7');
        $Aug1=$db->getAttendancefo($name,$id,$year,'8');
        $Sep1=$db->getAttendancefo($name,$id,$year,'9');
        $Oct1=$db->getAttendancefo($name,$id,$year,'10');
        $Nov1=$db->getAttendancefo($name,$id,$year,'11');
        $Dec1=$db->getAttendancefo($name,$id,$year,'12');
        ?>
				var a1 = <?php echo $Jan ?>;
				var b1 = <?php echo $Feb ?>;
				var c1 = <?php echo $Mar ?>;
				var d1 = <?php echo $Apr ?>;
				var e1 = <?php echo $May ?>;
				var f1 = <?php echo $Jun ?>;
				var g1 = <?php echo $Jue ?>;
				var h1 = <?php echo $Aug ?>;
				var i1 = <?php echo $Sep ?>;
				var j1 = <?php echo $Oct ?>;
				var k1 = <?php echo $Nov ?>;
				var l1 = <?php echo $Dec ?>;

				var a2 = <?php echo $Jan1 ?>;
				var b2 = <?php echo $Feb1 ?>;
				var c2 = <?php echo $Mar1 ?>;
				var d2 = <?php echo $Apr1 ?>;
				var e2 = <?php echo $May1 ?>;
				var f2 = <?php echo $Jun1 ?>;
				var g2 = <?php echo $Jue1 ?>;
				var h2 = <?php echo $Aug1 ?>;
				var i2 = <?php echo $Sep1 ?>;
				var j2 = <?php echo $Oct1 ?>;
				var k2 = <?php echo $Nov1 ?>;
				var l2 = <?php echo $Dec1 ?>;



				data = [
					[a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1],
					[a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2]
				];
				var data_max = 35;
				var line_title = ["Work", "Offday"];
				var y_label = "Number of days";
				var x_label = "Month"; //X轴标题
				var x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
				var title = "The detail statistics of this staff ";
				j.jqplot.diagram.base("chart1", data, line_title, "The detail statistics of this staff ", x, x_label, y_label, data_max, 1);
				j.jqplot.diagram.base("chart2", data, line_title, "The detail statistics of this staff ", x, x_label, y_label, data_max, 2);
                
                
                    

			</script>
		</div>
	</body>

</html>
